For defineButton2 , you need to modify or add the following fields:
File Length, ActionRecordsOffset (which is currently undocumented), the ActionOffset , the Condition , the RecordHeader size portion, and add ActionRecord .
A 32 bit field in the SWF file header.
RecordHeader for the defineButton2
The RecordHeader contains the tagID and length. You need to update the length. Note that there are short and long formats for record headers, depending on the size of the record. The tagID for defineButton2 is 34.
This 16 bit field is missing from the SWF File Format Specification. It occurs in between the Flags and Buttons fields. It is initially set to zero if there are no actions for the button. If there are actions for the button, then it must contain the offset from the point in the SWF file following this 16-bit value to the beginning of the ActionOffset field.
DefineButton2 =
Header
ButtonID
Flags
ActionRecordsOffset (this is missing from the spec)
Buttons
ButtonEndFlag
Button2ActionCode
ActionOffset
Condition
Action [ActionRecords]
ActionEndFlag
There is one ActionOffset per condition (mouse overDownToIdle ). This is the offset used to skip over the Condition and the following actions (the ActionRecord ) for the condition. You need to update this value when adding actions.
The condition field is roughly equivalent to a wired movie event. The actions associated with button state transition condition are triggered when the transition occurs. You need to add or edit this field.
Flash actions each have their own action tag code. QuickTime actions use a single QuickTimeActions code: 'AA' . You may add a list of actions to a single QuickTimeActions tag.
The format of the QuickTimeActions tag is as follows:
1 byte: Tag = 'AA'
2 bytes: data length (size of the QTAtomContainer)
n bytes the data which is the QTAtomContainer holding the wired
actions
For DoAction , you need to modify a subset of the defineButton2 fields in the same manner as described above. These fields are:
File Length, the RecordHeader size portion, and the ActionRecord.
| Previous | Chapter Contents | Chapter Top |